package fragments;


import android.os.Bundle;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.baseproject.BaseFragment;
import com.example.administrator.newxlmedical.R;

import beans.RegisterInfoBean;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import constants.Constants;
import constants.HandlerConstant;
import customhandler.MyHandler;
import singleton.SingletonClass;

/**
 * A simple {@link Fragment} subclass.
 */
public class RegisterFailureFragment extends BaseFragment {

    @BindView(R.id.tv_register_success_sure)
    TextView tvSure;
    Unbinder unbinder;
    private RegisterInfoBean bean;
    private MyHandler allHandler;

    public RegisterFailureFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_register_failuer, container, false);
        unbinder = ButterKnife.bind(this, view);
        bean = (RegisterInfoBean) getArguments().getSerializable(Constants.BASE_IRIS_REGISTER_FRAGMENT);
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @Override
    protected void initView() {
        super.initView();
        allHandler = SingletonClass.getSingleton(MyHandler.class);
    }

    @OnClick(R.id.tv_register_success_sure)
    public void onViewClicked() {
        Message message = allHandler.obtainMessage();
        message.what = HandlerConstant.REGISTER_FAILURE_FRAGMENT_SURE;
        message.obj = bean;
        allHandler.sendMessage(message);
    }
}
